package com.example.callcenter.controller;

import com.example.callcenter.dto.PageQueryDTO;
import com.example.callcenter.dto.StatisticsDTO;
import com.example.callcenter.service.IStatisticsService;
import com.example.callcenter.util.ResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/statistics")
public class StatisticsController {

    @Autowired
    private IStatisticsService statisticsService;

    @GetMapping("/system")
    public ResultUtil getSystemStatistics() {
        StatisticsDTO stats = statisticsService.getSystemStatistics();
        return ResultUtil.success(stats);
    }

    @GetMapping("/task")
    public ResultUtil getTaskStatistics(@RequestParam Long taskId) {
        return statisticsService.getTaskStatistics(taskId);
    }

    @GetMapping("/sales")
    public ResultUtil getSalesStatistics(PageQueryDTO queryDTO) {
        return statisticsService.getSalesStatistics(queryDTO);
    }
}